<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--suppress ALL-->
<html xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<base th:href="@{/}"><!-- 不用base就使用th:src="@{/js/jquery.min.js} -->
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>天天生鲜-首页</title>
	<link rel="stylesheet" type="text/css" href="css/reset.css">
	<link rel="stylesheet" type="text/css" href="css/main.css">
	<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript" src="js/jquery-ui.min.js"></script>
	<script type="text/javascript" src="js/slide.js"></script>
</head>
<body>
	<div class="header_con">
		<div class="header">
			<div class="welcome fl">欢迎来到天天生鲜!</div>
			<div class="fr">
				<div class="login_info fl">
					欢迎您：<em>张 山</em>
				</div>
				<div class="login_btn fl">
					<a href="/index">首页</a>
					<a href="/toLogin" th:if="${session.user==null}">登录</a>
					<span th:if="${session.user!=null}" th:text="'欢迎：'+${session.user.userEmail}" style="color: black"></span>
					<span>|</span>
					<a href="/toRegister">注册</a>
				</div>
				<div class="user_link fl">
					<span>|</span>
					<a href="/toUserCenterInfo">用户中心</a>
					<span>|</span>
					<a href="/carttable/myCart">我的购物车</a>
					<span>|</span>
					<a href="/focustable/myFocus">我的收藏</a>
					<span>|</span>
					<a href="/toUserCenterOrder?currentPage=1&pageSize=4">我的订单</a>
				</div>
			</div>
		</div>		
	</div>

	<div class="search_bar clearfix">
		<a href="index.html" class="logo fl"><img src="images/logo.png"></a>
		<div class="search_con fl">
			<form action="/goodstable/searchForGoods">
				<input type="text" class="input_text fl" name="goodsName" placeholder="搜索商品">
				<input type="submit" class="input_btn fr" value="搜索">
			</form>
		</div>
		<div class="guest_cart fr">
			<a href="/carttable/myCart" class="cart_name fl">我的购物车</a>
			<div class="goods_count fl" id="show_count">1</div>
		</div>
	</div>

	<div class="navbar_con">
		<div class="navbar">
			<h1 class="fl">全部商品分类</h1>
			<ul class="navlist fl">
				<li><a href="">首页</a></li>
				<li class="interval">|</li>
				<li><a href="">手机生鲜</a></li>
				<li class="interval">|</li>
				<li><a href="">抽奖</a></li>
			</ul>
		</div>
	</div>

	<div class="center_con clearfix" >
		<ul class="subnav fl" >
			<li ><a th:each="gType:${goodstypes}"   th:text="${gType.typeName}"></a></li>
		</ul>
		<div class="slide fl">
			<ul class="slide_pics">
				<li><img src="images/slide.jpg" alt="幻灯片"></li>
				<li><img src="images/slide02.jpg" alt="幻灯片"></li>
				<li><img src="images/slide03.jpg" alt="幻灯片"></li>
				<li><img src="images/slide04.jpg" alt="幻灯片"></li>
			</ul>
			<div class="prev"></div>
			<div class="next"></div>
			<ul class="points"></ul>
		</div>
		<div class="adv fl">
			<a href="#"><img src="images/adv01.jpg"></a>
			<a href="#"><img src="images/adv02.jpg"></a>
		</div>
	</div>

	<div class="list_model" th:each="gType:${goodstypes}">
		<div class="list_title clearfix">
			<h3 class="fl" th:text="${gType.typeName}"></h3>
			<div class="subtitle fl">
				<span>|</span>
<!--				<a href="#">鲜芒</a>-->
<!--				<a href="#">加州提子</a>-->
<!--				<a href="#">亚马逊牛油果</a>-->
			</div>
			<a th:href="@{/user/toList(typeId=${gType.id})}" class="goods_more fr" id="fruit_more">查看更多 ></a>
		</div>
		<div class="goods_con clearfix" >
			<div class="goods_banner fl" ><img th:src="'images/' + ${gType.typePicture}"></div>
			<ul class="goods_list fl">

				<li th:each="goods :${goodstable}" th:if="${goods.typeId}==${gType.id}">
					<div >
						<h4><a href="#" th:text="${goods.name}" ></a></h4>
						<a th:href="@{/goodstable/goodsDetail(goodId=${goods.id})}"><img th:src="'images/'+ ${goods.picture}"></a>
						<div class="prize">¥ 30.00</div>
						<a th:href="'javascript:focus('+ ${goods.id} +')'"  class="btn btn-primary" style="font-size: 6px;">加入收藏</a>
					</div>

				</li>
			</ul>
		</div>

<!--		<div class="goods_con clearfix" >-->
<!--			<div class="goods_banner fl" ><img th:src="'images/' + ${gType.typePicture}"></div>-->
<!--			<ul class="goods_list fl">-->
<!--				<li th:each="goods , indexStatus:${goodstable}" th:if="${goods.typeId}==${gType.id}">-->
<!--					<div th:if="${indexStatus.index}<4">-->
<!--						<h4><a href="#" th:text="${goods.name}" ></a></h4>-->
<!--						<a th:href="@{/goodstable/goodsDetail(goodId=${goods.id})}"><img th:src="'images/' + 'goods/' + ${goods.picture}"></a>-->
<!--						<div class="prize">¥ 30.00</div>-->
<!--						<a th:href="'javascript:focus('+ ${goods.id} +')'"  class="btn btn-primary" style="font-size: 6px;">加入收藏</a>-->
<!--					</div>-->

<!--				</li>-->
<!--			</ul>-->
<!--		</div>-->
	</div>

<div class="footer">
	<div class="foot_link">
		<a href="#">关于我们</a>
		<span>|</span>
		<a href="#">联系我们</a>
		<span>|</span>
		<a href="#">招聘人才</a>
		<span>|</span>
		<a href="#">友情链接</a>
	</div>
	<p>CopyRight © 2016 北京天天生鲜信息技术有限公司 All Rights Reserved</p>
	<p>电话：010-****888    京ICP备*******8号</p>
</div>
<style>
	.copyrights{text-indent:-9999px;height:0;line-height:0;font-size:0;overflow:hidden;}
</style>

</body>
<script>
	// 加入收藏
	function focus(goodId){
		//发起ajax请求
		$.get("/focustable/focus",{"goodId":goodId}, function(data){
			if(data.code==200){
				alert(data.message);
			}else{
				alert(data.message);
			}
		},"json");
	}
</script>
</html>